
import java.io.PrintWriter;
import java.util.HashMap;

class VariableAssign extends Declaration {

	private Node value_;
	private String name_;

	public VariableAssign(String n, Node v) {
		name_ = n;
		value_ = v;
	}

	@Override
	public void print(PrintWriter pw) {
		pw.println("Node name : VariableAssign. Var name is: " + name_);
		value_.print(pw);
	}

	@Override
	public String translate(HashMap<String, PrintWriter> pws, String condition, SymbolTable st,
			String parent) {
		
		String key = st.getStack().get(1);
		PrintWriter pw = pws.get(key);
		// TODO Auto-generated method stub
		value_.translate(pws, null,st, parent);
		pw.print("=");
		pw.print(name_);
		pw.println(";");
		return null;
	}

}